package org.jctc.els.modules.biz.service.message.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jctc.els.modules.biz.mapper.message.MessageTypeMapper;
import org.jctc.els.modules.biz.service.message.IMessageTypeService;
import org.jctc.els.modules.biz.entity.message.MessageType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * <p>
 * 消息类型表 服务实现类
 * </p>
 *
 * @author lyh
 * @since 2021-02-26
 */
@Service
public class MessageTypeServiceImpl implements IMessageTypeService {

    @Autowired
    private MessageTypeMapper messageTypeMapper;

    @Override
    public boolean save(MessageType messageType){
        return messageTypeMapper.insert(messageType)>0;
    }

    @Override
    public boolean remove(Long id){
        return messageTypeMapper.deleteById(id)>0;
    }

    @Override
    public boolean edit(MessageType messageType){
        return messageTypeMapper.updateById(messageType)>0;
    }

    @Override
    public  Page<MessageType> selectListByPage(Integer pageNum, Integer pageSize){
    Page<MessageType> messageTypePage = new Page<>(pageNum, pageSize);
    MessageType messageType = new MessageType();

    return (Page<MessageType> )  messageTypeMapper.selectPage(messageTypePage, Wrappers.query(messageType));
    }

    @Override
    public MessageType selectById(Long id){
        return  messageTypeMapper.selectById(id);
    }
}
